﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using whatpricemyhouse.LINQ;

namespace whatpricemyhouse.Admin
{
    public partial class editSellSetting : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!User.Identity.IsAuthenticated)
            {
                Response.Redirect("~/Admin/Default.aspx");
            }
            if (!User.IsInRole("administrator "))
            {
                Response.Redirect("~/Admin/Default.aspx");
            }
        }
        DataControllerDataContext dcdc = new DataControllerDataContext();
        protected void CAddButton_Click(object sender, EventArgs e)
        {
            String name = CNameTxt.Text;
            String desc = CDescTxt.Text;
            String id = Guid.NewGuid().ToString();

            construction_table ct = new construction_table();
            ct.ConstructionID = id;
            ct.ConstructionName = name;
            ct.ConstructionDesc = desc;
            dcdc.construction_tables.InsertOnSubmit(ct);
            dcdc.SubmitChanges();
            GridView2.DataBind();
        }

        protected void YATAddButton_Click(object sender, EventArgs e)
        {
            String name = YATNameTxt.Text;
            String desc = YATDescTxt.Text;
            String id = Guid.NewGuid().ToString();

            you_are_the_table yatt = new you_are_the_table();
            yatt.YATTID = id;
            yatt.YATTName = name;
            yatt.YATTDesc = desc;
            dcdc.you_are_the_tables.InsertOnSubmit(yatt);
            dcdc.SubmitChanges();
            GridView1.DataBind();
        }
    }
}